package com.jason.exp.web;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class HelloController {
	
	@RequestMapping(name="/hello", method=RequestMethod.GET)
	public String hello() {
		return "hello";
	}
	
	@RequestMapping(name="/hello", method=RequestMethod.POST)
	public String doHello(
			@RequestParam(name="name", required=true) String name,
			Model model
	) {
		model.addAttribute("name", name);
		return "hello";
	}

}
